<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{log_name} : {log_account_no}</title>
<link rel="shortcut icon" href="{dir_image}favicon.ico">
<link rel="stylesheet" type="text/css" href="{dir_css}Global.css" />
<link rel="stylesheet" type="text/css" href="{dir_css}Popup.css" />
<link rel="stylesheet" type="text/css" href="{dir_css}Student.css" />

<script type="text/javascript" src="{dir_js}jquery.min.js"></script>
<script type="text/javascript" src="{dir_js}Global.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		
		if( $('#saved_record').val() == 1 ) {
			alert('Student Registration Successful.');
			parent.popupRequest('hide');
			return false;
		}
		
		courseDept();
		
		if ( $('#txtaccountno').val() == '' ) {
			accountNo('');
		}
		
	});
	
	function accountNo(strAccount) {
		
		var m = $('#m').val();
		var d = $('#d').val();
		var y = $('#y').val();
		var h = $('#h').val();
		var i = $('#i').val();
		
		$('#txtaccountno').val('S' + y + '' + m + d + '-' + h +  i);
			
	}

	function courseDept() {
		
		var courseID = $('#txtcourse').val();
		var departmentID = $('#txtdepartment option:selected').val();
		var course_popup_div = $('#course_popup_div');
		$.post('request.php', {AJAXPost:'courseDepartment', strDepartmentID:departmentID}, function(res) {
			
			$.each( res, function( key, value ) {
				
				if ( value['course_idPK'] == courseID ) {
					var courseActive = ' checked="checked"';
				}
				else {
					var courseActive = '';
				}
				
				course_popup_div.append('<div><label for="course_radio' + value['course_idPK'] + '"  id="co_requisite_label">'+
											'<input type="radio" id="course_radio' + value['course_idPK'] + '" value="' + value['course_idPK'] + '" name="course_radio" onclick="courseValue(\'' + value['course_idPK'] + '\')" ' + courseActive + '/> ' + value['course_desc'] + ' (' + value['course_code'] +')'+
										'</label></div>');
										
			});
			
		}, 'json');
	}
	
	function courseValue(courseID) {
		$('#txtcourse').val(courseID);
	}
</script>
</head>

<body style="background-color:#FFF;">
<div class="title-frame">Registration</div>
	<div class="title-sub">
		Enter your Name, E-mail Address and Your Enrolled Course.
	</div>
	<div class="popup-spacer"></div>
	
<input type="hidden" id="saved_record" value="{saved_record}"/>
<input type="hidden" id="m" value="{m}"/>
<input type="hidden" id="d" value="{d}"/>
<input type="hidden" id="y" value="{y}"/>
<input type="hidden" id="h" value="{h}"/>
<input type="hidden" id="i" value="{i}"/>
<form method="post" enctype="multipart/form-data" action="">
	<table width="750" border="0" cellspacing="0" cellpadding="0">
		<tr valign="top">
			<td width="88">Course Offered<span class="required-field">*</span></td>
			<td width="12">:</td>
			<td width="650">{department_list}
				<input type="hidden" name="txtcourse" id="txtcourse" value="{txtcourse}" /> <span class="required-field">{w_txtcourse}</span>
				<div class="course-popup" id="course_popup">
					<div id="course_popup_div"></div>
				</div>
			</td>
		</tr>
		<tr>
			<td height="8" colspan="3"></td>
		</tr>
		<tr>
			<td width="130" height="28">Student #<span class="required-field">*</span></td>
			<td width="10">:</td>
			<td width="350"><input type="hidden" name="txtaccountno" id="txtaccountno" class="text-input" value="{txtaccountno}" />{txtaccountno}</td>
		</tr>
		<tr>
			<td height="28">First Name<span class="required-field">*</span></td>
			<td>:</td>
			<td><input type="text" name="txtfname" class="text-input" value="{txtfname}"/> <span class="required-field">{w_txtfname}</span></td>
		</tr>
		<tr>
			<td height="28">Last Name<span class="required-field">*</span></td>
			<td>:</td>
			<td><input type="text" name="txtlname" class="text-input" value="{txtlname}" /> <span class="required-field">{w_txtlname}</span></td>
		</tr>
		<tr>
			<td height="28">E-mail Addres<span class="required-field">*</span></td>
			<td>:</td>
			<td><input type="text" name="txtemail" class="text-input" value="{txtemail}"/> <span class="required-field">{w_txtemail}</span></td>
		</tr>
		<tr>
			<td height="28">Contact #<span class="required-field">*</span></td>
			<td>:</td>
			<td><input type="text" name="txtcontact" class="text-input" value="{txtcontact}"/></td>
		</tr>
		<tr>
			<td height="8" colspan="3"></td>
		</tr>
		<tr>
			<td height="28">Username<span class="required-field">*</span></td>
			<td>:</td>
			<td><input type="text" name="txtusername" class="text-input" value="{txtusername}"/> <span class="required-field">{w_txtusername}</span></td>
		</tr>
		<tr>
			<td height="28">Password<span class="required-field">*</span></td>
			<td>:</td>
			<td><input type="password" name="txtpassword" class="text-input" value=""/> <span class="required-field">{w_txtpassword}</span></td>
		</tr>
		<tr>
			<td height="28"></td>
			<td></td>
			<td><input type="submit" name="subButton" class="submit-input" value="Save"/></td>
		</tr>
	</table>
</form>
	<div class="popup-spacer"></div>
	<div class="message-content">
		An e-mail has been sent to you from registrar office that contains your valid student number and your password.
		If you didn't receive any email within 48 hours, go to registrar office.
	</div>
</body>
</html>
